<template>
  <div>
    <my-header
      :background="'blue'"
      :fontColor="'white'"
      title="TabBar案例"
    ></my-header>
    <div class="main">
      <component :is="comName"></component>
    </div>
    <my-tab-bar :arr="tabList" @changeCom="changeComFn"></my-tab-bar>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader.vue";
import MyTabBar from "./components/MyTabBar.vue";
import MyTable from "./components/MyTable.vue";
import MyGoodsList from "./view/MyGoodsList.vue";
import MyGoodsSearch from "./view/MyGoodsSearch.vue";
import MyUserInfo from "./view/MyUserInfo.vue";
export default {
  components: {
    MyHeader,
    MyTable,
    MyTabBar,
    MyGoodsList,
    MyGoodsSearch,
    MyUserInfo,
  },
  data() {
    return {
      comName: "MyGoodsList", // 默认显示的组件
      // 底部导航数据
      tabList: [
        {
          iconText: "icon-file",
          text: "商品列表",
          componentName: "MyGoodsList",
        },
        {
          iconText: "icon-search",
          text: "商品搜索",
          componentName: "MyGoodsSearch",
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "MyUserInfo",
        },
      ],
    };
  },
  methods: {
    changeComFn(cName) {
      this.comName = cName;
    },
  },
};
</script>

<style>
.main {
  margin-top: 45px;
  margin-bottom: 51px;
}
</style>